package com.lhf.springcloud.DAO;

import com.lhf.springcloud.Entity.teacher.TeacherData;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Repository
@Mapper
public interface TeacherDao {
    @Insert("insert into teacher_data (id,teacher_name,teacher_level) values((select uuid()),#{teacherName},#{teacherLevel})")
    void addCourse(TeacherData teacherData);
    @Select("select id,teacher_name teacherName,teacher_level teacherLevel,status,join_date joinDate from teacher_data")
    List<TeacherData> findAllData();
    @Select("select COUNT(1) teacherName,teacher_level teacherLevel,YEAR(join_date) year from teacher_data where status='是' and YEAR(join_date)=#{year} GROUP BY teacher_level")
    List<TeacherData> findTeacherNumByYear(String year);
    @Select("select COUNT(1) teacherName,teacher_level teacherLevel from teacher_data where status='是' GROUP BY teacher_level")
    List<TeacherData> findTeacherNum();
    @Select("select teacher_name,id_card from teacher_data where id_card = #{idCard}")
    List<TeacherData> findTeacherByIdCard(String idCard);
}
